package com.xjgc.common.config;


import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBus;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;



/**
 * bean 注册
 *
 * @author wxy
 * @date 2019/11/1
 */
@Configuration
@ImportResource(locations = {"classpath:cxf-client.xml"})
public class CxfConfig {


    @Bean(name = Bus.DEFAULT_BUS_ID)
    public SpringBus springBus() {
        return new SpringBus();
    }
//
//    /*---SapToMsi---*/
//
//    @Bean
//    @ConditionalOnMissingBean
//    public SapToMsi sapToMsi() {
//        return new SapToMsiImpl();
//    }
//
//    @Bean
//    //@ConditionalOnBean
//    public Endpoint endpoint(SpringBus springBus, SapToMsi sapToMsi) {
//        EndpointImpl endpoint = new EndpointImpl(springBus, sapToMsi);
//        endpoint.publish("/SapToMsi");
//        return endpoint;
//    }
//
//    /*---SapToYj---*/
//
//    @Bean
//    @ConditionalOnMissingBean
//    public SapToYj SapToYj() {
//        SapToYjImpl sapToYj = new SapToYjImpl();
//        return sapToYj;
//    }
//
//    @Bean
//    //@ConditionalOnBean
//    public Endpoint endpointSapToYj(SpringBus springBus, SapToYj sapToYj) {
//        EndpointImpl endpoint = new EndpointImpl(springBus, sapToYj);
//        endpoint.publish("/SapToYj");
//        return endpoint;
//    }
//    /*---CgToMsi---*/
//
//
//    @Bean
//    @ConditionalOnMissingBean
//    public CgToMsi capToMsi() {
//        return new CgToMsiImpl();
//    }
//
//    @Bean
//    public Endpoint endpointCapToMsi(SpringBus springBus, CgToMsi capToMsi) {
//        EndpointImpl endpoint = new EndpointImpl(springBus, capToMsi);
//        endpoint.publish("/CgToMsi");
////        endpoint.getInInterceptors().add(new WsInterceptor()); //add webservice inteceptor
//        return endpoint;
//    }

    /*
     *//*---SapToMsiReal---*//*
    @Bean
    @ConditionalOnMissingBean
    public SapToMsiReal SapToMsiReal() {
        SapToMsiRealImpl sapToMsiReal = new SapToMsiRealImpl();
        return sapToMsiReal;
    }

    @Bean
    //@ConditionalOnBean
    public Endpoint endpointSapToMsiReal(SpringBus springBus, SapToMsiReal sapToMsiReal) {
        EndpointImpl endpoint = new EndpointImpl(springBus, sapToMsiReal);
        endpoint.publish("/SapToMsiReal");
        return endpoint;
    }*/


}
